Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Programmer's Overview / Part 1 - Getting Started With QuickDraw GX
Chapter 3 - Using QuickDraw GX Objects


Transforms

The transform object allows you to specify clipping, mapping, hit-testing, and viewing information for your shape objects. Like all objects, transform objects have properties that you can examine and edit. When you draw a shape, QuickDraw GX examines the properties of the shape's transform object, modifies the appearance of the shape as indicated by the values of properties
of its transform object (one of which references a list of view port objects), and renders the shape.

Figure 3-30 shows the properties of the transform object and gives some sample effects.

Figure 3-30 Transform objects and examples of their properties

The next few sections discuss the clip, mapping, and view port list properties of the transform object.

Clips

The clip property of a transform object allows you to clip a shape--that is, limit the amount of the shape that is drawn to a certain area. As an example, you could set the clip property of the transform object of all of your shapes to limit their drawing area to a certain rectangular area.

You are not limited to rectangular clips, however. You can have many different kinds of clips: polygons, paths, glyphs, in some cases even bitmaps!

Figure 3-31 shows two sample shapes modified by their transform clips.

Figure 3-31 Sample shapes clipped by transforms

In the upper half of this figure, a rectangle shape is clipped by a jug-shaped path. In the lower half of this figure, a path shape is clipped by a path that consists of thick, wavy lines. After the shapes are clipped, only those parts of the original shapes that intersect with their clip shape are actually shown.

You can examine or modify the clip property of a transform object using the GXGetTransformClip and GXSetTransformClip functions. Similarly, you can examine and modify the clip of an transform associated with a specified shape using the GXGetShapeClip and GXSetShapeClip functions.

If you want no clipping to occur, you can specify that the clip shape be a full shape--this is called a full clip (and it is the default).

Mappings

The mapping property of a transform object contains a matrix that QuickDraw GX multiplies against the geometric coordinates of a shape before drawing the shape. With this mapping matrix, you can distort a shape in many ways: scaling, skewing, rotating, adding perspective, and so on. If you want no mapping to occur, you can specify the identity mapping (which is the default).

Figure 3-32 shows some examples of the effects you can create using the mapping property of a shape object.

Figure 3-32 Effects of mappings

You can examine and modify the mapping property of a transform
object directly using the functions GXGetTransformMapping and GXSetTransformMapping. Similarly, QuickDraw GX provides the functions GXGetShapeMapping and GXSetShapeMapping for manipulating the mapping property of the transform object associated with a particular shape.

QuickDraw GX also provides a number of functions that perform certain calculations on the mapping matrix of a transformation for you. These functions include GXMoveTransform, GXMoveTransformTo, GXScaleTransform, GXRotateTransform, and GXSkewTransform.

A similar group of functions--GXMoveShape, GXMoveShapeTo, GXScaleShape, GXRotateShape, and GXSkewShape--applies transformations to the transform object of a specified shape. (Actually, as mentioned in Chapter 2, depending on the value of the shape's map transform attribute, these functions can instead apply their transformation directly to the geometric points stored in the
shape's geometry.)

View-Related Objects

The transform object's view port list property contains a list of references to view port objects. A view port object is an object that represents a drawing destination: for example, a Macintosh window. When you draw a shape, QuickDraw GX renders the shape into the view ports referenced by the view port list of the shape's transform object.

The properties of a view port object determine its characteristics:

Figure 3-33 shows the properties of a view port object and the relationship between view ports, view groups, and view devices.

Figure 3-33 View groups, view ports, and view devices

View ports, view groups, and view devices are all objects, although they are limited in some ways. For example, you cannot clone view-related objects and you cannot copy view group objects. QuickDraw GX provides some standard functions to manipulate these objects, as well as functions to examine and modify their properties.

The QuickDraw GX view architecture and the different coordinate spaces
of QuickDraw GX are discussed further in Chapter 4, "Using Macintosh Windows." For a complete discussion, see Inside Macintosh: QuickDraw GX Objects.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help